<template>
	<view>
		<!--日记本列表首页-->
		<button @click="add">创新日记本</button>
		<uni-table>
			<uni-tr v-for="item in tableDate" :key="item.id">
				<view style="float: left;padding-right: 10px;" >
					<image :src="item.filePath" style="width: 50px;height: 50px;" ></image>
				</view>
				<view style="padding-left: 42px;">
					<view>{{item.diaryItemLabelName}}</view>
					<view>共{{ item.diaryFileId }}篇日记</view>
				</view>	
				<view class="uni-group" style="padding-left: 50px;">
					<button class="uni-button" size="mini" type="primary" @click="addDiary">追加日记</button>	
				</view>
				<button></button>
			</uni-tr>
		</uni-table>
		</view> 
</template>

<script>
	export default {
		
		data() {
			return {
			tableDate:[],
			}
		},
		
		onLoad() {
			this.diarylist()
		},
		  
		methods: {
			//日记列表展示全部
			diarylist(){
				uni.request({
					//路径getDiaryList是diary表展示全部数据到页面
					url: 'http://localhost:8090/contents/diary/getDiaryList',
					method: 'get',
					dataType: 'json',
					success: (res) => {
						if (res.data.flag) {
						this.tableDate = res.data.object
							console.log(this.tableDate)
						}
					}
				})
			},
		
			add(){
				uni.navigateTo({
					//添加日记本
					url:'/pages/publish/adddiary',
				})
			},
			addDiary(){
				//发布日记
				uni.navigateTo({
					url:'/pages/publish/release',
				})
			},
			
			modify(){
				//修改日记本
				uni.navigateTo({
					url:'/pages/publish/modify',
				})
			},
		}
	}
</script>

<style>

</style>
